/******************************************************************************
//             INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright (c) 2000-2001 Intel Corporation. All Rights Reserved.
//
//  Description:
//      Intel(R) JPEG library for X platform 
//
********************************************************************************/
#include "_ijx.h"

/******************************************************************************
// Name:            ijInitFrameSpecFwd
// Description:     Encode frame info of JPEG
// Input Arguments:
//         pStream: Identifies IJBITTREAMSTATE data structure.
// Output Arguments:
//    pDecodeState: Identifies IJDECODESTATE strcuture.
//                          
// Returns:          
//        [Success] IJX_RTCODE_OK
//        [Failure] IJX_RTCODE_BAGARG
//                  IJX_RTCODE_F_INSUFFICIENTBUF
//                  IJX_RTCODE_E_ERRPARAM
//                  
******************************************************************************/
IJXRESULT ijInitFrameSpecFwd(int nMode, IJENCODESTATE *pEncodeState)
{
/*
    if (bMotion) {
        pEncodeState->frameSpec.nSOF=IJX_MARKER_SOFV;
        pEncodeState->procSpec.funcMotionDiffEncoder=pEncodeState->procSpec.funcMotionDiffFirst;
    } else if (IJX_MODE_PROGRESSIVE&pEncodeState->nJPEGMode) {
        pEncodeState->frameSpec.nSOF=IJX_MARKER_SOF2;
        pEncodeState->nStatus&=~(IJX_STATUS_CREATEDCOEFF);
    } else {
        pEncodeState->frameSpec.nSOF=IJX_MARKER_SOF0;
    }
*/
    switch (nMode) {
        case IJX_MODE_BASELINE:
        case IJX_MODE_BASELINE_A:
            pEncodeState->frameSpec.nSOF=IJX_MARKER_SOF0;
            break;
        case IJX_MODE_PROGRESSIVE:
            pEncodeState->frameSpec.nSOF=IJX_MARKER_SOF2;
            pEncodeState->nStatus&=~(IJX_STATUS_CREATEDCOEFF);
            break;
        case IJX_MODE_MOTION_INDIV:
            //pEncodeState->frameSpec.nSOF=IJX_MARKER_SOF0;
            //break;
        case IJX_MODE_MOTION_DIFF:
        case IJX_MODE_MOTION_BRIEF:
            pEncodeState->frameSpec.nSOF=IJX_MARKER_SOFV;
            pEncodeState->procSpec.funcMotionDiffEncoder=pEncodeState->procSpec.funcMotionDiffFirst;
            break;
    }

    pEncodeState->frameSpec.nPrecision=pEncodeState->nPrecision;
    pEncodeState->frameSpec.nHeight=pEncodeState->imageSpec.nHeight;
    pEncodeState->frameSpec.nWidth=pEncodeState->imageSpec.nWidth;
    pEncodeState->frameSpec.nNumComps=pEncodeState->imageSpec.nNumComponent;

    /* MCU Counter */
//    pEncodeState->counter.nFrameMCUCounter=0;
//    pEncodeState->counter.nScanMCUCounter=0;

    /* Scan Counter */
    pEncodeState->counter.nFrameScanCounter=pEncodeState->counter.nScanCounter;
//    pEncodeState->counter.nTotalScanCounter+=pEncodeState->counter.nScanCounter;
    pEncodeState->counter.nScanCounter=0;
    pEncodeState->counter.nFrameScanCounter=0;

    /* Frame Counter */
    pEncodeState->counter.nTotalFrameCounter++;
//    pEncodeState->counter.nCurMotionFrameBits=0;
//    pEncodeState->counter.nBaseMotionFrameBits=0;
    pEncodeState->counter.nMotionFrameCounter=0;

    return IJX_RTCODE_OK;
}

/* EOF */
